package servlet.admin;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.OrdersService;

/**
 * Servlet implementation class AdminOrdersStatusServlet
 */
@WebServlet("/admin/orders_status")
public class orders_status_Servlet extends HttpServlet {
	
	private  OrdersService  oService  = new OrdersService();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		int id = Integer.parseInt(request.getParameter("id"));
		
		int status = Integer.parseInt(request.getParameter("status"));
		
		oService.updateStatus(id, status);
		
		response.sendRedirect(request.getContextPath()+"/admin/orders_list?status="+status);
		
	}



}
